/**
 * el-dialog 是否穿透
 */
import Vue from "vue";
const directive= (el, binding, vnode, oldVnode) => {
    let context = vnode.context,
        penetrate = binding.value;

    if(penetrate) {
        el.setAttribute("style", "pointer-events: none;");
        // const headerDom = el.querySelector('.el-dialog__header');
        // const bodyDom = el.querySelector('.el-dialog__body');
        // const footerDom = el.querySelector('.el-dialog__footer');
        setTimeout(() => {
            const elList = [
                '.el-dialog__header', '.el-dialog__body', '.el-dialog__footer'
            ];
            elList.forEach(item => {
                let dom = el.querySelector(item);
                if(!dom) return;
                dom.setAttribute("style", "pointer-events: all;");
            })
        },0)
    }

};

Vue.directive("penetrate", {
    update: directive,
    bind: directive
});
